package com.ubxtech.xxljob.req;

import com.ubxtech.xxljob.util.ExecutorRouteStrategyEnum;
import com.ubxtech.xxljob.util.MisfireStrategyEnum;
import com.ubxtech.xxljob.util.ScheduleTypeEnum;
import com.xxl.job.core.enums.ExecutorBlockStrategyEnum;
import com.xxl.job.core.glue.GlueTypeEnum;
import lombok.Data;

/**
 * 添加job
 * 参考 https://github.com/xuxueli/xxl-job/blob/master/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobInfo.java
 * @author Victor.Xiao
 * @since 2022-11-17 17:00
*/
@Data
public class XxlJobAddReq {

    /* ================基础配置 */
    /** 执行器主键ID,执行器 */
    private Integer jobGroup;
    private String jobDesc ="robot task";
    /** 负责人 */
    private String author ="admin";
    /** 报警邮件 */
    private String alarmEmail;


    /* ================调度配置 */
    /** 调度类型 */
    private ScheduleTypeEnum scheduleType = ScheduleTypeEnum.CRON;
    /** 调度配置，值含义取决于调度类型 */
    private String scheduleConf;



    /* ================任务配置 */
    /** 执行器，任务Handler名称 */
    private String executorHandler;
    /** 执行器，任务参数 */
    private String executorParam;
    /** GLUE类型	#com.xxl.job.core.glue.GlueTypeEnum */
    private GlueTypeEnum glueType = GlueTypeEnum.BEAN;


    /* ================高级配置 */
    /** 执行器路由策略 */
    private ExecutorRouteStrategyEnum executorRouteStrategy = ExecutorRouteStrategyEnum.ROUND;
    /** 子任务ID，多个逗号分隔 */
    private String childJobId;
    /** 调度过期策略 */
    private MisfireStrategyEnum misfireStrategyEnum = MisfireStrategyEnum.DO_NOTHING;
    /** 阻塞处理策略 */
    private ExecutorBlockStrategyEnum executorBlockStrategy = ExecutorBlockStrategyEnum.SERIAL_EXECUTION;
    /** 任务执行超时时间，单位秒 */
    private int executorTimeout = 0;
    /** 失败重试次数 */
    private int executorFailRetryCount = 0;
    /** GLUE备注 */
    private String glueRemark = "glueRemark";

}
